using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Barbar.MapReport.DataSource.Entities;

namespace Barbar.MapReport.DataSource.Esri {
  /// <summary>
  /// Polygon z Shp souboru
  /// </summary>
  internal class ShpPolygon : RawPolygon {
    internal ShpPolygon(int[] parts, ShpPoint[] points) {
      RawPolyline polyline = null;
      int partIndex = 0;
      for (int i = 0; i < points.Length - 1; i++) {
        if (partIndex < parts.Length && parts[partIndex] == i) {
          if (polyline != null)
            Add(polyline);
          polyline = new RawPolyline();
          partIndex++;
        }
        polyline.Add(new Point((decimal)points[i].X, (decimal)points[i].Y));
      }
      Add(polyline);
    }
  }
}
